home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_02_01
/
2n01061a
< prev
next >
Wrap
Text File
|
1990-09-15
|
1KB
|
34 lines
#include<io.h>
#include<errno.h>
#include<dos.h>
#include"redirector.h"
/*******************************************************************
* lock_write() - write shared data to a network file
*
* Parameters:
* handle (in) - file handle to read from
* buffer (in) - buffer to place data in
* length (in) - number of bytes to read
*
* Returns:
* Return code is identical to write()
*
* Notes:
* 1. This routine assumes that the record to be written
* was previously read using lock_read().
*
* History:
* Original code by William H. Roetzheim, 1989
**********************************************************************/
int lock_write(int fh, char *buffer, unsigned int length)
{
int count;
count = write(fh, buffer, length); /* write data out */
unlock(fh, lseek(fh, -length, SEEK_CUR), length);
return count;
}